﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity.Framework;

namespace Business.Operations
{
    public class KlasmanOperation
    {
        private static HPDMASEntities db = new HPDMASEntities();

        public static Klasman KlasmanGetByKlasmanId(int klasmanId)
        {
            var klasman = (from c in db.Klasman where c.KlasmanID == klasmanId select c).First();
            return klasman;
        }

        public static List<Klasman> KlasmanGetAll()
        {
            var klasmanList = db.Klasman.ToList();
            return klasmanList;
        }

        public static Klasman KlasmanGetByKlasmanAdi(string klasmanAdi)
        {
            var klasman = (from c in db.Klasman where c.KlasmanAdi == klasmanAdi select c).First();
            return klasman;
        }

        public static List<string> KlasmanAdiGetAll()
        {
            var klasmanAdi = (from s in db.Klasman orderby s.KlasmanAdi ascending select s.KlasmanAdi).ToList();
            return klasmanAdi;
        }

        public static int KlasmanIdGetByKlasmanAdi(string klasmanAdi)
        {
            var klasmanId = (from c in db.Klasman where c.KlasmanAdi == klasmanAdi select c.KlasmanID).First();
            return klasmanId;
        }

        public static string KlasmanAdiGetByKullaniciId(int kullaniciId)
        {
            var klasmanAdi = (from k in db.Kullanici where k.KullaniciID == kullaniciId select k.Klasman.KlasmanAdi).First();
            return klasmanAdi;
        }
    }
}
